package com.rainng.coursesystem.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

@TableName("rc_exam")
@Data
public class ExamEntity {
    public static final String ID = "id";
    public static final String STUDENT_ID = "student_id";
    public static final String LOCATION = "location";
    public static final String STATUS = "status";
    public static final String COURSE_ID = "course_id";
    public static final String BEGIN_TIME = "begin_time";
    public static final String END_TIME = "end_time";


    @NotNull
    @TableId(value = ID, type = IdType.AUTO)
    private Integer id;


    @Length(max = 100, message = "地址长度不能超过100个字符")
    @NotNull(message = "地址不能为空")
    @TableField(LOCATION)
    private String location;

    @NotNull(message = "状态不能为空")
    @TableField(STATUS)
    private Integer status;

    @NotNull(message = "课程ID不能为空")
    @TableField(COURSE_ID)
    private Integer courseId;

    @TableField(BEGIN_TIME)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime beginTime;

    @TableField(END_TIME)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;
}    